import request from '@/utils/request2'

export function getRoutes() {
  return request({
    url: '/routes',
    method: 'get'
  })
}

// 添加
export function createTrainConst(temp) {
  return request({
    url: '/ehs-train-const/add',
    method: 'post',
    baseURL: process.env.VUE_APP_BASE_API2,
    params: temp
  })
}
// 列表
export function fetchTrainConstList(query) {
  return request({
    url: '/ehs-train-const/list',
    method: 'get',
    baseURL: process.env.VUE_APP_BASE_API2,
    params: query
  })
}
// 获取明细
export function getTrainConst() {
  return request({
    url: '/ehs-train-const/detail',
    method: 'get'
  })
}

// 添加
export function addTrainConst(data) {
  return request({
    url: '/ehs-train-const/add',
    method: 'post',
    data
  })
}

// 伪删除
export function deleteTrainConst(id) {
  return request({
    url: '/ehs-train-const/delete',
    method: 'get',
    baseURL: process.env.VUE_APP_BASE_API2,
    params: { id }
  })
}

// 修改
export function editTrainConst(query) {
  return request({
    url: '/ehs-train-const/edit',
    method: 'post',
    baseURL: process.env.VUE_APP_BASE_API2,
    params: query
  })
}
// 附件上传
export function upload(query) {
  return request({
    url: '/ehs-train-const/upload',
    method: 'post',
    baseURL: process.env.VUE_APP_BASE_API2,
    params: query
  })
}
// 查询总数量
export function fetchAllCount() {
  return request({
    url: '/ehs-train-const/count',
    method: 'get',
    baseURL: process.env.VUE_APP_BASE_API2
  })
}

// 获取人员列表
export function getPersonList() {
  return request({
    url: '/ehs-train-const/personlist',
    method: 'get',
    baseURL: process.env.VUE_APP_BASE_API2

  })
}

// 获取承包商列表
export function getContractorList() {
  return request({
    url: '/ehs-train-const/contractorlist',
    method: 'get',
    baseURL: process.env.VUE_APP_BASE_API2

  })
}

// 获取承包商列表
export function getWorkerList() {
  return request({
    url: '/ehs-train-const/workerlist',
    method: 'get',
    baseURL: process.env.VUE_APP_BASE_API2

  })
}
export function selectWorker(workername) {
  return request({
    url: '/ehs-train-const/selectWorkerList',
    method: 'get',
    params: { workerName: workername }
  })
}
